<%@ page language="java" import="java.util.*" pageEncoding="UTF-8"%>
<%@ taglib uri="/struts-tags" prefix="s"%>
<%--
	auth : Conner
	date : 2012-09-10
	desc : 编辑系统消息设置
--%>
<%
	String path = request.getContextPath();
	String basePath = request.getScheme() + "://" + request.getServerName() + ":" + request.getServerPort() + path + "/";
%>
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<html xmlns="http://www.w3.org/1999/xhtml">
<head>
<meta http-equiv="Content-Type" content="text/html; charset=utf-8" />
<jsp:include page="/admin/common/css/style_sub.jsp"></jsp:include>
<script type="text/javascript" src="<%=basePath%>js/public.js"></script>
<link rel="stylesheet" type="text/css" href="<%=basePath%>js/lib/validation/css/livevalidation.css" />
<script type="text/javascript" src="<%=basePath%>js/lib/validation/livevalidation.js"></script>
<script type="text/javascript" src="<%=basePath%>js/lib/jquery/jquery-1.7.1.min.js"></script>
<script language="javascript">
$(function(){
	//$("#bCode")[0].focus();
	checkAll();
});

function checkAll(){
	var infoCotent = new LiveValidation('infoCotent',{ wait : 500},{onlyOnSubmit:true});
		infoCotent.add( Validate.Presence, {failureMessage: "不能为空!"}); 
		infoCotent.add( Validate.Length, { maximum: 33 } );

	var url = new LiveValidation('url',{ wait : 500},{onlyOnSubmit:true});
		url.add( Validate.Presence, {failureMessage: "不能为空!"});
		url.add( Validate.Length, { maximum: 100 } );

	var spTime = new LiveValidation('spTime',{ wait : 500},{onlyOnSubmit:true});
		spTime.add( Validate.Presence, {failureMessage: "不能为空!"});
		spTime.add(Validate.Numericality, { notANumberMessage : "请输入数字!"});

	var cueTime = new LiveValidation('cueTime',{ wait : 500},{onlyOnSubmit:true});
		cueTime.add( Validate.Presence, {failureMessage: "不能为空!"});
		cueTime.add( Validate.Length, { maximum: 3 } );
		cueTime.add(Validate.Numericality, { notANumberMessage : "请输入数字!"});
		
	var remark = new LiveValidation('remark',{ wait : 500},{onlyOnSubmit:true});
		remark.add( Validate.Presence, {failureMessage: "不能为空!"});
		remark.add( Validate.Length, { maximum: 100 } );
}

//自动填写文本框的值
var k = 0;
var alr = "";
function autoDo(){
	var objText, objCheckbox;
	objText = G("cueTime");
	objCheckbox = G("chk1");
	objText.value = objCheckbox.checked == true ? "0" : alr;
}
function setValue(){
	alr = G("cueTime").value;
}
</script>
</head>
<body>
	<div class="title">编辑系统消息设置</div>
	<form action="<%=basePath %>basic/sys/msgSet_update.action" id="form" method="post">
		<div class="editorTab">
			<table>
				<tbody>
					<tr>
						<th><font>*</font>类型编号</th>
						<td>
							<input type="text" name="sysSetInfo.bCode" id="bCode" 
								value='<s:property value="%{sysSetInfo.bCode }"/>' readonly="readonly"/>
						</td>
						<th><font>*</font>默认提示内容</th>
						<td>
							<input type="text" name="sysSetInfo.infoCotent" 
								id="infoCotent" value='<s:property value="%{sysSetInfo.infoCotent }"/>'/>
						</td>
					</tr>
					<tr>
						<th>当前状态</th>
						<td>
							<label><input type="radio" name="sysSetInfo.state" value="1" 
								<s:if test='%{sysSetInfo.state == "1"}'>checked="checked"</s:if>/>
							<img src="<%=basePath %>style/icons/ok.png" title="启用" 
								alt="启用" align="absmiddle"/></label>&nbsp;&nbsp;&nbsp;&nbsp;
							<label><input type="radio" name="sysSetInfo.state" value="2" 
								<s:if test='%{sysSetInfo.state == "2"}'>checked="checked"</s:if>/>
							<img src="<%=basePath %>style/icons/pause.png" title="停用" 
								alt="停用" align="absmiddle"/></label>
						</td>
						<th>短信提醒</th>
						<td>
							<label><input type="radio" name="sysSetInfo.isNote" value="1" 
								<s:if test='%{sysSetInfo.isNote == "1"}'>checked="checked"</s:if>/>是</label>&nbsp;&nbsp;
							<label><input type="radio" name="sysSetInfo.isNote" value="2" 
								<s:if test='%{sysSetInfo.isNote == "2"}'>checked="checked"</s:if>/>否</label>
						</td>
					</tr>
					<tr>
						<th><font>*</font>间隔时间(单位：毫秒)</th>
						<td>
							<input type="text" name="sysSetInfo.spTime" 
								id="spTime" value='<s:property value="%{sysSetInfo.spTime }"/>'/>
						</td>
						<th>首次提醒</th>
						<td>
							<label><input type="radio" name="sysSetInfo.isFirst" value="1" 
								<s:if test='%{sysSetInfo.isFirst == "1"}'>checked="checked"</s:if>/>是</label>&nbsp;&nbsp;
							<label><input type="radio" name="sysSetInfo.isFirst" value="2" 
								<s:if test='%{sysSetInfo.isFirst == "2"}'>checked="checked"</s:if>/>否</label>
						</td>
					</tr>
					<tr>
						<th><font>*</font>最大提醒次数</th>
						<td>
							<input type="text" name="sysSetInfo.cueTime" id="cueTime" 
								onkeydown="javascript:setValue();" onkeyup="javascript:setValue();" 
								value='<s:property value="%{sysSetInfo.cueTime }"/>'/>&nbsp;&nbsp;
							<label><input type="checkbox" id="chk1" onclick="javascript:autoDo();" 
								<s:if test='%{sysSetInfo.cueTime == "0"}'>checked="checked"</s:if>/>&nbsp;不限制</label>
						</td>
						<th>&nbsp;</th>
						<td>&nbsp;</td>
					</tr>
					<tr>
						<th><font>*</font>查看URL</th>
						<td>
							<textarea name="sysSetInfo.url" id="url" rows="3" 
								class="downMenu"><s:property value="%{sysSetInfo.url }"/></textarea>
						</td>
						<th>备注</th>
						<td>
							<textarea name="sysSetInfo.remark" id="remark" rows="3" 
								class="downMenu"><s:property value="%{sysSetInfo.remark }"/></textarea>
						</td>
					</tr>
				</tbody>
			</table>
		</div>
	
		<div class="infoTips">
			加"<font>*</font>"的为必选或必填项
		</div>
		
		<div class="btns">
			<span class="btn"><input type="submit" id="submitBtn" value="修改" /></span>
			<span class="btn">
				<input type="button" id="cancelBtn" value="返回" 
					onclick="javascript:window.history.back();"/>
			</span>
		</div>
	</form>
</body>
</html>
